<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>

</body>
</html>
<script !src="">
    // 1.数字或字符串数组去重，效率高
    arr = [1, 3, 4, 2, 77, 55, 6, 3, 1, 6]
    arr2 = [2, 2, 3, 3, 4, 4, 5, 5]

    function requireData(arr) {
        let result = {};
        for (let i = 0; i < arr.length; i++) {
            if (!result[arr[i]]) {
                result[arr[i]] = true
            }
        }
        return Object.keys(result)
    }

    console.log(requireData(arr))

    // 2.任意数组去重，适配范围光，效率低

    function requestData() {
        return [...new Set(arr2)]
    }

    console.log(requestData())
</script>
